ALCHP

Syntax: ALCHP (space)
    or: ALCHP (space [,[jobID]])        (BTool only)
Location: Toolkit II, THOR XVI, BTool

The function ALCHP allocates space bytes in the common heap and returns the start address of the memory setaside to be altered freely. This, unlike RESPR, works even if there is a task running in memory.

The BTool version of ALCHP allows an extended syntax. If space is followed by a comma ',' then the allocated memory can only be removed with RECHP or CLCHP (unlike the other versions where this is done automatically with NEW and CLEAR).  If the jobID is specified then not only will this be done, but the memory will also be linked to the Job identified by jobID.

Example:
x=ALCHP(32000) will set aside 32000 bytes of memory

NOTE:
ALCHP reserves memory in 512 byte chunks.  If there is insufficient memory, the value returned is 0 (not an error).

CROSS-REFERENCE:
The reserved parts of memory can be given back to QDOS' memory management by RECHP base_address or CLCHP.
RESPR, TTALL, ALLOCATION and especially GRAB and RESERVE work similar to ALCHP.
See DEL_DEFB concerning heap fragmentation.
